package com.dao;

import com.entity.User;

import java.sql.SQLException;

/**
 * @ProjectName: shop
 * @Author: Jsx
 * @Time: 2020/8/30 12:44
 * @Description:
 */
public interface UserDao {
    /**
     * 判断账号是否存在
     * @param username
     * @return
     */
    Long queryUserNameExist(String username) throws SQLException;

    /**
     * 用户信息插入数据库
     * @param user
     * @return
     */
    int insertUser(User user) throws SQLException;

    /**
     * 数据库code更新
     * @param code
     * @param activeCode
     * @return
     */
    int updateUserCode(String code,int activeCode) throws SQLException;

    /**
     * code查询用户
     * @param code
     * @return
     */
    Long queryUserByCode(String code) throws SQLException;

    /**
     * 置空激活码
     * @param code
     */
    void updateUserCodeToNull(String code) throws SQLException;

    /**
     * 查询用户,去登录
     * @param username
     * @param password
     * @return
     */
    User queryUser(String username,String password) throws SQLException;
}
